package com.copa.l2180;

/**
 * @author copa
 * @createDate 2023-01-06 10:52
 * @function 暴力法
 */
public class Test2 {

    public int countEven(int num) {
        int result = 0;
        for (int i = 1; i <= num; i++) {
            int temp = i;
            int sum = 0;
            while (temp > 0) {
                sum += temp % 10;
                temp /= 10;
            }
            result = sum % 2 == 0 ? ++result : result;
        }
        return result;
    }

    public static void main(String[] args) {
        int num = 30;
        System.out.println(new Test2().countEven(num));
    }
}
